package test;

import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JFrame;

import obj.Edge;
import obj.Node;
import obj.Path;

public class MainTestFrame extends JFrame {

	private static final long serialVersionUID = -5363423645860415477L;

	private CarComponent comp;

	public static final int DEFAULT_WIDTH = 450;

	public static final int DEFAULT_HEIGHT = 350;

	Path p1 = null;
	Path p2 = null;
	Path p3 = null;
	Path p4 = null;

	public MainTestFrame() {
		getContentPane().setBackground(new Color(85, 107, 47));
		setSize(800, 600);
		setTitle("move");
		final ArrayList<Path> pathsList = new ArrayList<Path>();
		comp = new CarComponent();
		comp.setBackground(new Color(85, 107, 47));
		getContentPane().add(comp, BorderLayout.CENTER);

		ArrayList<Edge> eList1 = new ArrayList<Edge>();
		Edge e1 = new Edge("e1", new Node(129, 353, "Node1"), new Node(474, 35, "Node2"));
		eList1.add(e1);
		
		Edge e5 = new Edge("e5", new Node(474, 35, "Node2"), new Node(905, 252, "Node3"));
		eList1.add(e5);

		ArrayList<Edge> eList2 = new ArrayList<Edge>();
		Edge e2 = new Edge("e2", new Node(10, 510, "Node3"), new Node(800, 510, "Node4"));
		eList2.add(e2);

		ArrayList<Edge> eList3 = new ArrayList<Edge>();
		Edge e3 = new Edge("e3", new Node(306, 473, "Node1"), new Node(1025, 579, "Node2"));
		eList3.add(e3);

		ArrayList<Edge> eList4 = new ArrayList<Edge>();
		Edge e4 = new Edge("e4", new Node(10, 600, "Node3"), new Node(600, 900, "Node4"));
		eList4.add(e4);

		p1 = new Path("Path1", 45, 10, eList1);
		p2 = new Path("Path2", 55, 12, eList2);
		p3 = new Path("Path3", 45, 10, eList3);
		p4 = new Path("Path4", 55, 12, eList4);
		pathsList.add(p1);
		pathsList.add(p2);
		pathsList.add(p3);
		pathsList.add(p4);

		for (Path p : pathsList) {
			Runnable r = new PathTestRunnable(comp, p);
			Thread t = new Thread(r);
			t.start();
		}
	}

}
